﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using System.Web.Mvc;

namespace Web.Commons.Attributes
{
    /// <summary>
    /// 页面缓存
    /// </summary>
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
    public class OutputCacheAttribute : ActionFilterAttribute
    {
        // Fields
        private OutputCacheParameters _cacheSettings;

        // Methods
        public OutputCacheAttribute();
        public override void OnResultExecuting(ResultExecutingContext filterContext);

        // Properties
        public string CacheProfile { get; set; }
        internal OutputCacheParameters CacheSettings { get; }
        public int Duration { get; set; }
        public OutputCacheLocation Location { get; set; }
        public bool NoStore { get; set; }
        public string SqlDependency { get; set; }
        public string VaryByContentEncoding { get; set; }
        public string VaryByCustom { get; set; }
        public string VaryByHeader { get; set; }
        public string VaryByParam { get; set; }

        // Nested Types
        private sealed class OutputCachedPage : Page
        {
            // Fields
            private OutputCacheParameters _cacheSettings;

            // Methods
            public OutputCachedPage(OutputCacheParameters cacheSettings);
            protected override void FrameworkInitialize();
        }
    }

}
